import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/mms/v1/store/member/list',
    method: 'get',
    params: query
  })
}

export function createMember(data) {
  return request({
    url: '/mms/v1/store/member/save',
    method: 'post',
    data
  })
}
export function deleteMember(data) {
  return request({
    url: '/mms/v1/store/member/delete',
    method: 'post',
    data
  })
}

export function getScheduleList(query) {
  return request({
    url: '/mms/v1/store/member/schedule/list',
    method: 'get',
    params: query
  })
}

export function saveSchedule(data) {
  return request({
    url: '/mms/v1/store/member/schedule/save',
    method: 'post',
    data
  })
}

export function getMemberDetail(query) {
  return request({
    url: `/mms/v1/store/member/detail/${query.id}`,
    method: 'get'
  })
}

export function getMemberList(query) {
  return request({
    url: `/mms/v1/store/member/${query.memberId}/class/deduct/list`,
    method: 'get',
    params: query
  })
}

export function addMemberTimes(data) {
  return request({
    url: `/mms/v1/store/member/${data.memberId}/class/times/add`,
    method: 'post',
    data
  })
}

export function delMemberTimes(data) {
  return request({
    url: `/mms/v1/store/member/${data.memberId}/class/times/deduct`,
    method: 'put',
    data
  })
}

export function getAddList(query) {
  return request({
    url: `/mms/v1/store/member/class/add/list`,
    method: 'get',
    params: query
  })
}

export function downloadFile(query) {
  return request({
	  url: `/mms/v1/store/member/list/download`,
	  method: 'get',
	  params: query,
	  responseType: 'blob' // 二进制流
  })
}
